package com.zto.tx.app;

import com.zto.tx.anno.MyAOPAnnotation;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;

/**
 * @program: sch-diy-parent
 * @description:
 * @author: sch
 * @create: 2020-12-23 22:31
 **/
@Aspect
@Component
public class MyAspectByAnno {
    @Around("@annotation(myAOPAnnotation)")
    public Object annoBefore(ProceedingJoinPoint proceedingJoinPoint, MyAOPAnnotation myAOPAnnotation) throws Throwable {
        Signature signature = proceedingJoinPoint.getSignature();
        System.out.println("around anno..." + signature.getName());

        return proceedingJoinPoint.proceed();
    }
}
